-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Integration test framework #1290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cmd/web.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this (and RegisterRoutes to a new modules/router instead? Since they really shouldn't be here anyway 🙂 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
models/models.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nononononono, there's a reason that this isn't here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, I added it as a temporary hack so the tests would work; I realize that sqlite has to be explicitly enabled. Perhaps I should have made that clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured out the non-hacky way to make things work, so this has been removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break for everyone... Don't put the test-repos in here, have the test pull it from somewhere (or untar/unzip)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I didn't realize there were hard-coded absolute paths in here. If we pull from somewhere else, we'll still have to edit all of these scripts to have the correct path (which is doable, but annoying).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the scripts to use $GITEA_ROOT instead of a hard-coded path. We'll have to export the appropriate value for GITEA_ROOT before running integration tests involving these scripts.
|
Also don't call it |
364f6c7 to
474e231
Compare
|
Rebased, renamed |
|
I'd like the integration test framework to also let me test PostgreSQL
as a backend (for example). So I'd prefer fixtures to be passed to the
ORM to fill the target DB of choice for testing.
|
|
@lunny I am aware, but there are some problems with these integration tests (see PR description). It was my understanding that #741 and #1135 were not a permanent solution (#1135 (comment)). |
e5f0858 to
6ca850a
Compare
|
Rebased to resolve conflicts. @strk I've updated it to use testfixtures, so to use another RDBMS all you have to do is modify |
4fcb88b to
3541bd1
Compare
|
@ethantkoenig would it be possible to script the app.ini update so to have |
a267737 to
1eeae42
Compare
|
@strk I've created separate |
5d08ed1 to
96669d4
Compare
.gitignore
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
.drone.yml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could leave the intended command in here, for reference, like echo make 'test-pgsql #not ready yet' (and same for all non-ready blocks)
.drone.yml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you mentioned this was actually passing on drone ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
strk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't add that tar.gz to the repository (what is it for?).
Also, I don't understand the changes to cmd/web.go
|
The The changes to |
|
Drone error seems unrelated to the change:
|
|
LGTM 🎉 I'd just disable Xorm log output on console. |
|
@bkcsoft why |
Makefile
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the archive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It contains the git repositories for the integration tests. It is necessary, because some integration may need to run git commands, or access files in the repositories.
See also the "STORING THE INTEGRATION ENVIRONMENT" section of the PR description.
integrations/integration_test.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong import place
integrations/signup_test.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line.
integrations/view_test.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line
|
@strk @ethantkoenig I didn't really have a reason for |
c12cd0d to
e26283e
Compare
|
@lunny I've addressed your review, and moved |
|
LGTM |
.drone.yml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this changes? @ethantkoenig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test-mysql and test-pgsql still aren't ready to run in CI (although they do pass locally). Unfortunately, I've had a hard time debugging why they aren't passing in CI, and given how long it took to get a .drone.yml.sig for this PR, I think makes more sense to address them in a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also #1290 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
.drone.yml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this changes? @ethantkoenig
|
@strk I believe I have addressed all of your requested changes. |
|
Thanks, all checks pass now, just needs to be merged. Looking forward to enable the CI testing of mysql and postgresql ! |
|
conflicted. @ethantkoenig |
e26283e to
12fe342
Compare
|
@ethantkoenig I have resigned it. |
NOTE: Drone is currently failing due to
.drone.yml.sig, which needs to be updated.A new framework for integration tests. The main issues with our current integration tests are that it
My proposal is to have a test "environment" (database and filesystem containing repos). The integration test environment would be populated with "fixtures", somewhat similar to what we do for unit tests (plus actual repos in the filesystem). Right now, this is implemented by having a separate
app.inifor integration tests, as well as a collection of database fixtures and directory of repositories.Also implements @andreynering's suggestion from #1135 (comment) of using the
ServeHTTP(..)methodThis system would allow us to not only add integration tests, but also unit tests for components that interact with the filesystem (e.g. anything that runs git commands).
STORING THE INTEGRATION ENVIRONMENT:
In order to not have to store a bunch of test fixtures and repos inside the main gitea repository, I have created a separate repo (https://github.com/ethantkoenig/gitea-integration) that stores the integration test fixtures and repositories. This repo must be cloned to run integration tests. If we end up choosing this approach, it might make sense to transfer this repo to the
go-giteaorganization.WHAT TO DO WITH EXISTING INTEGRATION TESTS:
For now, I have removed the existing integration tests to clear up the
integrations/directory. I have ported all previous integration tests to the new framework.HOW TO RUN INTEGRATION TESTS:
make test-(sqlite|mysql|pgsql). You may need to update the correspondingintegrations/*.inito match whatever you have running locally.